---
# tasks file for glpi-agent

- name: glpi directory
  ansible.builtin.file:
    path: /opt/glpi
    state: directory

- name: download appimage
  ansible.builtin.copy:
    src: glpi-agent-1.5-x86_64.AppImage
    dest: /opt/glpi/glpi-agent.AppImage
    mode: +x

- name: install glpi
  ansible.builtin.command:
    cmd: "/opt/glpi/glpi-agent.AppImage --install --server {{ glpi_url }} --no-service"
    creates: /etc/glpi-agent

- name: glpi configuration
  ansible.builtin.copy:
    src: glpi.service
    dest: /etc/systemd/system/glpi.service
  notify:
  - restart glpi

- name: glpi service enable
  ansible.builtin.service:
    name: glpi
    enabled: yes